How to take sample from a data